245D - Restoring Table - CodeForces Solution


constructive algorithms greedy *1500

Please click on ads to support us..

C++ Code:

#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n; 
    cin>>n;
    int a[n][n], b[n];
    for (int i = 0; i < n; i++)
        {
            b[i]=0;
            for (int j = 0; j < n; j++)
                cin>>a[i][j];
        }
    for (int i = 0; i < n; i++) {
        for(int j=0; j<n; j++)
        if(i!=j)
        b[i]|=a[i][j];
    }
    for (int i = 0; i < n; i++) 
        cout<<b[i]<<" ";
        cout<<endl;
}


Comments

Submit
0 Comments
More Questions

Cutting a material
Bubble Sort
Number of triangles
AND path in a binary tree
Factorial equations
Removal of vertices
Happy segments
Cyclic shifts
Zoos
Build a graph
Almost correct bracket sequence
Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix